<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="BookEditDlg" widgetVar="BookEditDialog" modal="true" resizable="false" appendToBody="true" header="#{bundle.EditBookTitle}">

            <h:form id="BookEditForm">

                <h:panelGroup id="display">
                    <p:panelGrid  columns="2" rendered="#{bookController.selected != null}">

                        <h:outputLabel value="#{bundle.EditBookLabel_bookPK_idBook}" for="bookPK_idBook" />
                        <h:outputText id="bookPK_idBook" value="#{bookController.selected.bookPK.idBook}" />

                        <p:outputLabel value="#{bundle.EditBookLabel_name}" for="name" />
                        <p:inputText id="name" value="#{bookController.selected.name}" title="#{bundle.EditBookTitle_name}" required="true" requiredMessage="#{bundle.EditBookRequiredMessage_name}"/>

                        <p:outputLabel value="#{bundle.EditBookLabel_year}" for="year" />
                        <p:inputText id="year" value="#{bookController.selected.year}" title="#{bundle.EditBookTitle_year}" required="true" requiredMessage="#{bundle.EditBookRequiredMessage_year}"/>

                        <p:outputLabel value="#{bundle.EditBookLabel_author}" for="author" />
                        <p:inputText id="author" value="#{bookController.selected.author}" title="#{bundle.EditBookTitle_author}" />

                        <p:outputLabel value="#{bundle.EditBookLabel_location}" for="location" />
                        <p:inputText id="location" value="#{bookController.selected.location}" title="#{bundle.EditBookTitle_location}" />

                        <h:outputLabel value="#{bundle.EditBookLabel_avaiableCopies}" for="avaiableCopies" />
                        <p:inputText id="avaiableCopies" value="#{bookController.selected.avaiableCopies}" title="#{bundle.EditBookTitle_avaiableCopies}" required="true" requiredMessage="#{bundle.EditBookRequiredMessage_avaiableCopies}"/>

                        <h:outputLabel value="#{bundle.EditBookLabel_knowledgeArea}" for="knowledgeArea" />
                        <h:outputText id="knowledgeArea" value="#{bookController.selected.knowledgeArea.name}"/>

                        <h:outputLabel value="#{bundle.EditBookLabel_editorial}" for="editorial" />
                        <h:outputText id="editorial" value="#{bookController.selected.editorial.name}"/>

                        <h:outputLabel value="#{bundle.EditBookLabel_bookType}" for="bookType" />
                        <h:outputText id="bookType" value="#{bookController.selected.bookType.description}"/>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{bookController.save}" value="#{bundle.Save}" update="display,:BookListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,BookEditDialog);"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="BookEditDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
